package o;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.huawei.appgallery.agreementimpl.impl.bean.SignAgrReqBean;
import com.huawei.appgallery.agreementimpl.impl.bean.SignAgrReqInfo;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.appgallery.serverreqkit.api.listener.IServerCallBack;
import java.util.ArrayList;
import java.util.List;

public class ayf {
    private awl ˎ;
    private final boolean ˏ;

    public ayf(boolean z) {
        this.ˏ = z;
    }

    public void ॱ(@Nullable awl o_awl) {
        this.ˎ = o_awl;
    }

    public void ˊ() {
        awu o_awu = new awu();
        o_awu.ॱ(this.ˏ);
        o_awu.ˏ(ayn.ʽ());
        o_awu.ˋ(ayn.ʼ());
        ˎ(o_awu, new awp(this) {
            final /* synthetic */ ayf ˊ;

            {
                this.ˊ = r1;
            }

            public void ˊ(aww o_aww, awy o_awy) {
                if (o_awy == null) {
                    awg.ˎ.ˊ("ProtocolReportTask", "sign response is null");
                } else {
                    this.ˊ.ˎ(o_awy);
                }
            }
        });
    }

    private void ˎ(@NonNull awy o_awy) {
        boolean z = o_awy.ॱ() == 0 && o_awy.ˎ() == 0;
        awg.ˎ.ˋ("ProtocolReportTask", "onReportResult, report result: " + z);
        ayn.ˊ(z);
        if (this.ˎ != null) {
            this.ˎ.ˏ(this.ˏ, z);
        }
    }

    private static void ˎ(awu o_awu, final awp o_awp) {
        String ˋ = o_awu.ˋ();
        String ˊ = o_awu.ˊ();
        boolean ॱ = o_awu.ॱ();
        final cvt o_axo = new axo(ˋ, ˊ, ॱ);
        o_axo.ˎ(ˎ(ˋ, ˊ, ॱ));
        cfw.ˎ(o_axo, new IServerCallBack() {
            public void prePostResult(BaseRequest o_cvu, ResponseBean responseBean) {
            }

            public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
                aww o_aww = new aww(o_axo.ˎ().ˋ().size());
                axj o_axj = (axj) responseBean;
                awy o_awz = new awz();
                if (o_axj != null) {
                    o_awz.ˎ(o_axj.getResponseCode());
                    o_awz.ˏ(o_axj.getRtnCode_());
                } else {
                    Logger.e("ProtocolReportTask", "response code is error");
                    o_awz.ˏ(-1);
                }
                o_awp.ˊ(o_aww, o_awz);
            }
        });
    }

    protected static SignAgrReqBean ˎ(String str, String str2, boolean z) {
        SignAgrReqBean signAgrReqBean = new SignAgrReqBean();
        List arrayList = new ArrayList();
        arrayList.add(ॱ(str, str2, z));
        arrayList.add(ˊ(str, str2, z));
        signAgrReqBean.ˊ(arrayList);
        return signAgrReqBean;
    }

    private static SignAgrReqInfo ˊ(String str, String str2, boolean z) {
        SignAgrReqInfo signAgrReqInfo;
        if ("com.huawei.appmarket".equals(fis.ˎ().getPackageName())) {
            List arrayList = new ArrayList();
            arrayList.add("hiapp 10.2.1");
            signAgrReqInfo = new SignAgrReqInfo(str, str2, z, arrayList);
        } else {
            signAgrReqInfo = new SignAgrReqInfo(str, str2, z);
        }
        signAgrReqInfo.ˊ(axn.ˋ);
        signAgrReqInfo.ˏ(axh.ˏ(ContentManager.getInstant().getContext()));
        return signAgrReqInfo;
    }

    private static SignAgrReqInfo ॱ(String str, String str2, boolean z) {
        SignAgrReqInfo signAgrReqInfo;
        if ("com.huawei.appmarket".equals(fis.ˎ().getPackageName())) {
            List arrayList = new ArrayList();
            arrayList.add("hiapp 10.2.1");
            signAgrReqInfo = new SignAgrReqInfo(str, str2, z, arrayList);
        } else {
            signAgrReqInfo = new SignAgrReqInfo(str, str2, z);
        }
        signAgrReqInfo.ˊ(axn.ˊ);
        signAgrReqInfo.ˏ(axh.ˊ(ContentManager.getInstant().getContext()));
        return signAgrReqInfo;
    }
}
